import Request from './request'
import { localCache } from '@/utils/storage'

export default new Request({
	baseURL: import.meta.env.VITE_PROXY_URL,
	timeout: 1000 * 10,
	interceptors: {
		requestInterceptor: (config) => {
			// 携带token
			const token = localCache.getItem('token')

			if (token && config.headers) {
				config.headers.Authorization = token
			}
			return config
		}
	}
})
